import {
  mapGetters
} from 'vuex'
// 导出mixins
export default {
  computed: {
    ...mapGetters('m_cart', ['total'])
  },
  watch: {
    total() {
      this.setTabBarBadge()
    }
  },
  onShow() {
    this.setTabBarBadge()
  },
  methods: {
    setTabBarBadge() {
      if (this.total >= 0) {
        uni.setTabBarBadge({
          index: 2,
          text: this.total + ''
        })
      }
    }
  }
}
